#include <bits/stdc++.h>
using namespace std;
//青蛙跳台n
unsigned int jump_n(unsigned int n)
{
    if(n == 0 || n == 1)
        return 1;
        else{
            return 2 * jump_n(n-1);
        }
}
//青蛙跳台3
unsigned int jump_3(unsigned int n)
{
    int first_bit = 1;
    int second_bit = 2;
    int three_bit = 3;
    unsigned int result = 0;
    if(n == 1)
        return 1;
    else if(n == 2)
        return 2;
    else if(n == 3)
        return 3;
    else{
        while (n>3)
        {
            result = first_bit+second_bit+three_bit;
            first_bit = second_bit;//更新低位值为
            second_bit = three_bit;
            three_bit = result;//更新高位值
            n--;
        }
    }
    return result;
}
unsigned int sum(vector<int>& a)
{
    unsigned int n = 0;
    for(auto i:a)
        n+=i;
    return n;
}
//任意青蛙跳台，k为能跳的选项次数如1,2,3,则为3
//init 为初始的跳动，比如k=3,init[1]表示n=1能跳的可能性
unsigned int jump_k(unsigned int n,vector<int>init)
{
    int len = init.size();
    int k =init.size();
    unsigned int result = 0;
    if(n<=len)
        return init[n-1];
    else{
        while (n>k)
        {
            result = sum(init);
            for(int i=0;i<k-1;i++)
                init[i] = init[i+1];//更新低位
            init[k-1] =result;//更新高位值
            n--;
        }
    }
    return result;
}
int main() {
    vector<int> a={1,2,3};
    int k = 3;
    for(int i=1;i<10;i++)
        cout<<jump_k(i,a)<<endl;
    return 0;
}